UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aOUbEIWDAzWt0+DI4idSEBMZldv51thj2QjnaXGvJVg=' 
WHERE 
  key_id = '1d0d072363a3c25b306a2fa20dac5e61ff50de795e20b0cec8f1607e83bdd83b' 
  AND (
    token = 'aOUbEIWDAzWt0+DI4idSEBMZldv51thj2QjnaXGvJVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043