I've heard it can come out in peices but I don't know from experience since I'm only 26 weeks.
I lost my mucus plug at around 33 or 34 weeks , you can grow it back and lose it piece by piece or all at once
You can lose it in pieces and it can also regrow.
It can can come out in piece or all at once regrow and all come out again.