The reason for this, as far as I can see, was in the database file which holds the scripts - 61413404gyreekansoem.sqlite. I opened the table object_data with DB Browser for SQLite and noticed it contained two records with the same object store ID and key. Both appeared to contain my script in some kind of compressed form in the data field. After I edited the script in the browser, the second record appeared to contain the new version (version had changed). But after I closed the browser process and reopened it, something overwrote this second record with data from the first record, which always contained the old version of the script.
Solution was to copy the script's text to another place, delete the script from the menu, add it back again and paste the text. Now there is only one record in the table.