why not now? I just rode 200 kilometers last weekend. But on a more serious note, you have plenty of time to prepare. People all have their own ways of training, but for me once I can ride 60 miles in good form I'm good to go 100, no problem. If you were riding 100 miles a day, I might worry about burnout, but the occasional 5 hour ride is nothing to worry about.
Somehow the mountain bike part escaped me. I find mountain biking harder, and so I probably would work my way up to the distance a little more slowly. Still wouldn't worry about riding too much