UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J5IGLKMFc6LtOCGbJD986q/qig/hOqA43cG4ZX/TnCc=' 
WHERE 
  key_id = 'c1511c9e78695f7e12cc739c1d4c6ab5187849c159d79f11e3736703adc578ee' 
  AND (
    token = 'J5IGLKMFc6LtOCGbJD986q/qig/hOqA43cG4ZX/TnCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027