UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PtfYYwwWZvLzW3vhk1nde5SP9GYIY38YmFBss6aUTSI=' 
WHERE 
  key_id = '8d9cd50a61df047729f35cceaf58e2d7da8d0d51670906438642f75790468772' 
  AND (
    token = 'PtfYYwwWZvLzW3vhk1nde5SP9GYIY38YmFBss6aUTSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043