Same thing happen to me awhile back bro, I herniated a disc wich also squeezed some of the cushing out that compressed against my syatic nerve, I could barely walk or sleep for that matter, anyway I laid/stood/sat you name it, it hurt.
After the DR saw my MRI he said I would need surgery, but I didn't have insurance so I couldnt do it anyhow. I waited and about 3 monthes after that it felt 100% better.
But even when I was still out of the weight room I didnt once stray from my diet.
The main thing is just take some time off from the gym, keep eating healthy and let that back heal. I am sure everyone on this bored who is serious about lifting has some type of back problem. I myself am going through a shoulder injury right now its been hurting for about 2 months. But I wouldn't worry about losing all your muscle, once you get back in the gym you will get it back quick. Muscle memory is a great thing

Good look bro hope everything works out for you.