UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '348g21uPMJb0rQqzVbF0yGPRYasDfdjPpl0LC2x87AY=' 
WHERE 
  key_id = '94ae58d83b31f35cbaca65f776b88e4bba2e349427351f4290ae9ba908514777' 
  AND (
    token = '348g21uPMJb0rQqzVbF0yGPRYasDfdjPpl0LC2x87AY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052