I'm using IPB 3.4 and I tried that code before, simple, just delete old rows where date > than 2 years.
It crashed the database and the forum wasn't working (over 10 million topics, 80GB database).
I found this topic, see the last reply, do you think this is a better solution (they use ID but I can use date) or do you have a better solution: