I finally rewrote the entire code but with a different approach - that seems to be more efficient: I go over all posts, extract all blobids, save them in a big array. Then I take the blobids of the last 3 days and check if they are in the array, if not, they are not used and can be deleted (frontend by the admin). In other words, only two database queries!
I have also implemented a rotate feature because too many users upload pictures rotated :)
The plugin will be released in the latest version after some more testing, say two months (Christmas?!).
Greetings,
Kai