UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0CeFlAEuJxxHRUZ2JIBqpib5bvyiJKPyCccqXRlEUOw=' 
WHERE 
  key_id = '789f520f7f869a29b18ee9868f047a4dd8c62c8c76e60d4ec42f898c2c54e6ab' 
  AND (
    token = '0CeFlAEuJxxHRUZ2JIBqpib5bvyiJKPyCccqXRlEUOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029