The gate control theory of pain asserts that non-painful input closes the "gates" to painful input, which prevents pain sensation from traveling to the central nervous system. Therefore, stimulation by non-noxious input is able to suppress pain. Appropriate exercise can therefore have a benefitial impact on pain
https://www.youtube.com/watch?v=ZfWO2wciIUY