UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77XwdBf1rGX4CSM9KJFVdCaXRWhIJseWp13hpHi7Ahw=' 
WHERE 
  key_id = '343420711a26bc9c0bc8087e7d5ee685e109d9c4084fb5982f25c84b467240a1' 
  AND (
    token = '77XwdBf1rGX4CSM9KJFVdCaXRWhIJseWp13hpHi7Ahw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046