When you first call sqlite_step() for your SELECT statement, SQLite grabs a read-lock on the database file. It doesn't release this lock until you call sqlite_finalize(). When you execute your UPDATE, SQLite needs to get a write-lock on the database file. It can't get the write-lock while another connection (including one from the same process) is holding a read-lock.
So there is no way you can perform an UPDATE, INSERT or DELTE operation in the middle of a SELECT. Unfortunately, I think you'll need to structure your program differently. Dan.