Thanks, this works! For those who want to solve this problem as well: (as far as I remember) I did
psql -f mydb
\drop function sec_rotate_last_visit
I edited security.sql as outlined above.
And then: psql -f security.sql mydb.
By the way, it stays strange that a big database does not load at all. Maybe I should try and redump it, if needed without blobs (although that would take away a lot of important info).