If you're [not] you need to stretch before & after rides.
That coupled with a Magnesium sup can help prevent cramps.
Also take HOT baths with or without Epsom salt.
It gets worse the older you get.
Muscle fiber is elastic and at night hams & quads draw up and get tight which can lead to tears.