UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fuWHaK/IkCLd8Fg+PNFG4xZpc61bePJbqFBkPhwzx2g=' 
WHERE 
  key_id = '87cfc0cd0de16fb63b5357138924345472ef7c59fa8e3d0008881c461d35c131' 
  AND (
    token = 'fuWHaK/IkCLd8Fg+PNFG4xZpc61bePJbqFBkPhwzx2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031