UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3EhCjbr+efo9u78EGmBQWPcucaSNRij6c2IC5jI1s3M=' 
WHERE 
  key_id = '9b5cea2b6ed353696c9e83410fd942e34b804b5708234e763531891388faa6ad' 
  AND (
    token = '3EhCjbr+efo9u78EGmBQWPcucaSNRij6c2IC5jI1s3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016