UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oaGBJz8ingjcvwx+QFnRaGuTIZ6A1Sy/+PhgOmCqQFU=' 
WHERE 
  key_id = '9e60a995fa872c84e209667451d366e33ca44ce78c4b76a6e89de7508e429e7f' 
  AND (
    token = 'oaGBJz8ingjcvwx+QFnRaGuTIZ6A1Sy/+PhgOmCqQFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047