UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TmMvnqA16L968W9ysF2rivECkgHI62zvPbu/Av8vUxQ=' 
WHERE 
  key_id = '1598349a412303796b9858ec1df6c1335f6fddf2316434c2c056cdfbe8bf63de' 
  AND (
    token = 'TmMvnqA16L968W9ysF2rivECkgHI62zvPbu/Av8vUxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00081