As you have used a transaction, auto-commit won't we able for transactions.
Autocommit: This only makes transactions automatically commit at the end of the statement.
What is happening here's, another thread is holding a record lock on some record (you're changing each record within the table!) for too long, and your thread is getting timed out.
You can see a lot of details about the event when you issue this:
SHOW ENGINE INNODB standing
After the event (in SQL editor). Ideally, try this on a quiet test-machine.
If you wish to learn What Is SQL then visit this SQL Course.