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

Query time 0.00025