UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gIznIgaDDpmDKTG7And5dkbim5G15tK8j6xzVJqvzRc=' 
WHERE 
  key_id = '64c5af70b0d1e559148bc042b1a88cc2a5e869d349ebcfb166f2fc5ea1559c7a' 
  AND (
    token = 'gIznIgaDDpmDKTG7And5dkbim5G15tK8j6xzVJqvzRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040