UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Afd8x57PYq+ZzfOzJttUZladwXoS6QaQN+mCsWETh9Q=' 
WHERE 
  key_id = '5464227af9812ef1a6660bb514511e9ff2e4a7a8f8b027fdeab0ed43a598e5bb' 
  AND (
    token = 'Afd8x57PYq+ZzfOzJttUZladwXoS6QaQN+mCsWETh9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033