UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'makaIqvO99463zbhbLnYeDB1nbWMViN6B8RLs9BoJ2w=' 
WHERE 
  key_id = '8aa6b3a6cd68dafa76522caafcc7807aa8d088a20633b5d5d9da611c14215134' 
  AND (
    token = 'makaIqvO99463zbhbLnYeDB1nbWMViN6B8RLs9BoJ2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027