UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBnIj9VJcqOZTaR5reGEOY3zucXrh2mA1PNxpw0h4xw=' 
WHERE 
  key_id = '1e210baf4ecf097a7d97809961c0bd95599e3a2c06c6e6ff7714b51f583c0847' 
  AND (
    token = 'TBnIj9VJcqOZTaR5reGEOY3zucXrh2mA1PNxpw0h4xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016