@marco That’s rather dangerous since the version that the DB thinks it is (and probably actually is) needs to match what the code is expecting. Forcing them to be the same doesn’t suddenly change the DB structure.
I am not a WP expert but what I’d suggest is;
Find out what the DB thinks it is (check db_version entry in the options table against https://codex.wordpress.org/WordPress_Versions )
Download that version of WordPress. https://wordpress.org/download/release-archive/
Manually install that (FTP up the files after deleting wp-admin and wp-includes)
Trigger the upgrade from within the admin area.