I've done this about three times in my life, in exactly the way you did it. I think I used ice initially, but after some time, heat felt best. And yes, take something like Motrin. But the BEST thing for me was to lie flat on my back on the hardest surface I could tolerate and still find comfortable. Each time I injured my back like that, this was the thing that helped the most. So, I set up a bed on our living room floor, and even slept there. It's okay to have your head on a pillow, and your knees bent up if that helps; the main thing is to have the support of something straight and firm against your back, and to stay in that position for as long as you can. And try not to move around a lot, lift things, etc. when you do get up.
I never really knew what happened to my back when that happened! Only that this is what fixed it. (And it would take a few days to fix it, and a few more days still as it continued to heal.)
That's the reason I eventually got a super firm mattress, because this happened three times in a handful of years. Since getting the super firm mattress I haven't had it happen.