UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xLrnCnh7Wsdb1SloAxgUXZISyocXLL1qO2jAhfw2h4Y=' 
WHERE 
  key_id = '7bd9d793c6ae59f1115054e15f9e6714d3de50467cde5fd805c1ad0e522b14a4' 
  AND (
    token = 'xLrnCnh7Wsdb1SloAxgUXZISyocXLL1qO2jAhfw2h4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021