UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sxp++/iaBW7B0uwUmhMO82UYMIO08UuJEuaSqBq/nNo=' 
WHERE 
  key_id = '74b014aed8229e69174b55bb2c0d144c33ad259404f8e1e9cd18d2e7db185585' 
  AND (
    token = 'Sxp++/iaBW7B0uwUmhMO82UYMIO08UuJEuaSqBq/nNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037