Well from your description, there are a few possibilities which can cause this sort of pain. The first one is that you could have developed a severe muscle spasm which would explain the situation. This can occur commonly due to either dehydration or due to an electrolyte imbalance. In Most cases using an increased amount of plain water would be extremely useful along with drinking electrolyte rich fluids like gatorade or pedialyte. This is because potassium, calcium and magnesium deficiency can all cause severe muscle spasms and using the electrolyte rich fluids would help in solving this issue. If that does not help then apply heat to the area which will relax the muscles. in addition start using OTc anti inflammatory medications like motrin or aleve. In some severe cases muscle relaxants may be needed like flexeril or tinazidine.
Now the other possible cause for this could be costchondritis which is inflammation of teh cartilages of the ribs which can cause pain in the ribs and also cause radiation of the pain in a whole band like fashion. That again would be treated with the help of the same OTC anti inflammatory agents like motrin or aleve.
Lastly, if the pain worsens over the next 2-3 days and you start noticing a blistering rash in the region then this pain would be due to shingles which classically occurs in a band like fashion but i dont think this is likely in your case given your age but it would be worthwhile to keep an eye out for the rash just in case.
But for now try the above measures and medications, i have a feeling this is likely to be a muscle spasm which should settle with the above interventions.
Do you have any more questions?
Please leave a POSITIVE rating by clicking on the stars above, until you do i am not compensated for my time. You can continue to ask follow-up questions even after the POSITIVE rating. You can also ask questions from me directly by going on the link below,