I found the problem. MySQL newbie issue. :(
I had a session variable declared DECLARE log_id INT;
In the queries, that used log_id, MySQL is using the variable instead of the column from the table.
So the statement
SELECT value_id, log_id from testdata;
Returned the value_id from the table, but the variable log_id value. Renaming the declared variable solved the issue.
Consider this question answered! Thanks to everyone who provided input.