Handle SQLITE_BUSY by retrying when grabbing lock
Move pkg_lock schema into normal schema upgrade path

This avoids SQLITE_BUSY and the need to try to recreate the
tables on every exec. pkgdb_upgrade() uses pkgdb_transaction_begin()
which already handles SQLITE_BUSY.