UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GshFkuwghiVm8BdgZ3WRQkR6Equuq75acSceqOj//3I=' 
WHERE 
  key_id = 'c8a05bf485d7205ced0d6f3b0b813d179ba5702ce7393261b3b7ecc7bc9ed99f' 
  AND (
    token = 'GshFkuwghiVm8BdgZ3WRQkR6Equuq75acSceqOj//3I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038