Sounds like the "id" field on your mdl_sessions table might be corrupt. Make sure it is set to a BIGINT, AUTO_INCREMENT and PRIMARY_KEY
I agree with Conn, if you notice that there is no value on the INSERT statement for the column id, which means that the DB must assign a value to it (hence the auto increment option). Can you confirm that after following Conn's recommendation your problem went away?
It's all working now! Thanks!