UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1mvTAHafgcRayjryG6soEew7AeMopmFBRMXeyFQzsQ=' 
WHERE 
  key_id = 'fa653efcf3c3bfa59b351a64643117ffe6787909a6a785d843a8663fd758a1c5' 
  AND (
    token = 'J1mvTAHafgcRayjryG6soEew7AeMopmFBRMXeyFQzsQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025