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

Query time 0.00030