UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2hsGZwK+fracQ4L3OC024RYOjWnN3qC1XUcT+1Y+v+8=' 
WHERE 
  key_id = '3a276e0a54c30b2198e3ae64ee06c5c1dd437a75c6351d36b14824af16c02d4e' 
  AND (
    token = '2hsGZwK+fracQ4L3OC024RYOjWnN3qC1XUcT+1Y+v+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051