mysql – Difference between isolation levels in the locktable implementation

I'm trying to implement locking tables in the database with c ++ and mysql. I use tpc-a benchmarks where I simulate a mini bank database and run a bunch of threads on it and each thread performs 10 transactions simultaneously. The goal is to maintain consistency once all transactions are completed.
Here is a piece of code that is part of the loop for each thread to execute 10 times:

g_lockTableAccount-> lockRecord (hashInt (randomAccountNumSource, g_numAccount), randomAccountNumSource, GetCurrentThread ());
startTransaction (conn);
// get the first balance of the account and the branch.

std :: string query = "SELECT account_balance, branch_ID from` account` WHERE account_ID =" + std :: to_string (randomAccountNumSource) + ";";
executeQuery (conn, query);
MYSQL_RES * res = mysql_use_result (conn);
MYSQL_ROW row = mysql_fetch_row (res);

sourceAccountBalance = toInt (line[0])
sourceAccountBranch = toInt (line[1])
mysql_free_result (res);

// ------------------------------------------------ ---- --------------------
sourceAccountBalance - = amount;
std :: string query = "UPDATE` Account` SET SET account_balance = & # 39;" +
std :: to_string (sourceAccountBalance) + "where account_ID =" + std :: to_string (randomAccountNumSource) + ";";
executeQuery (conn, query);

// ------------------------------------------------ ---- --------------------
commitTransaction (conn);
g_lockTableAccount-> unlockRecord (hashInt (randomAccountNumSource, g_numAccount), randomAccountNumSource);

I lock and unlock other recordings with the same pattern. but I feel that there is something wrong because I think that the execution of a command sql and its validation are not correct, but the problem is that when I start a transaction at the beginning of for loop and that I commit in the end, this model causes blockages, because whatever the level of isolation, the database does not release the locks acquired How can I do it correctly and without deadlocks ?
is there at all?
How do different levels of isolation affect this problem?