UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sv1fx3YeJWOiiUatt+z0guUHHWC0t8QXblhjpoWlpHo=' 
WHERE 
  key_id = 'fc8e63f779e3d2524595792c74fc1e581e733c07cd3133451eeac619d739ffe2' 
  AND (
    token = 'sv1fx3YeJWOiiUatt+z0guUHHWC0t8QXblhjpoWlpHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039