UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wVDf1ZntFGbsR5nEgoDYSr2Zh1EeCcYN7GRWDtvOM4Y=' 
WHERE 
  key_id = '9c984c2eb8a055c373d1faf19dc5561f5298bd102bd4473df3315270571418ae' 
  AND (
    token = 'wVDf1ZntFGbsR5nEgoDYSr2Zh1EeCcYN7GRWDtvOM4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015