UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vthfn/nnmKWnxxvMBI5o5CwikeWvElNQv8nQNcC+Juc=' 
WHERE 
  key_id = 'e9bdcd8a3259a179cd153dae045c1815dc9ef63aae341bb66b8a5bcdc23040e0' 
  AND (
    token = 'vthfn/nnmKWnxxvMBI5o5CwikeWvElNQv8nQNcC+Juc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016