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

Query time 0.00018