UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U9JzxzwFKd2NN7k7Zqgfvy52bGL2ggAYTg+fDkFjgXk=' 
WHERE 
  key_id = '34d84b2c683cbbd2fa20aedcb9fce564151577bd5990660ff2c62c991a750876' 
  AND (
    token = 'U9JzxzwFKd2NN7k7Zqgfvy52bGL2ggAYTg+fDkFjgXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038