UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cd8Yo7fewUzbKaA95U0GVl+1/okQGC2f0mDA8S3ATZ8=' 
WHERE 
  key_id = 'db452394bbc5ec7f37768ffc11f009a491ef4f71df211a56c2bec4d09e406025' 
  AND (
    token = 'cd8Yo7fewUzbKaA95U0GVl+1/okQGC2f0mDA8S3ATZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027