UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z3a+ZwrXjpwx9oriaWtnmU3IZL4pQO6ovzxjFim+X/M=' 
WHERE 
  key_id = 'a109ad8587820f4060abc75b96d476fe84ad18522af618a366c45e09a34b03a5' 
  AND (
    token = 'z3a+ZwrXjpwx9oriaWtnmU3IZL4pQO6ovzxjFim+X/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044