内部循环中的Mysql Update返回0个受影响的行

I have an import from a web service to a MySql database. Web service returns xml format and depending on returned data I have to do INSERT OR UPDATE.

I'm using php mysqli and tested with prepared statements and old style query.

The problem is that updates return 0 affected rows. I knew the WHERE clause was right, so I went to mysql Workbench, write :

UPDATE sgji_discounts SET 
                      min_discount = 0,
                      max_discount = 6
        WHERE id = 77   

And check. The result was 1 affected row. But if I click the bolt button fast, it returns 0 affected rows in the output window.

Do I need to set a sleep between statemets? Is there any special way to execute updates inside a loop?

many thanks