Take cassette off.
Drop into sink.
Spray with a load of Hope Shit Shifter. Do NOT use Muc-Off, it’s nowhere near strong enough.
Run the hot tap and give the cassette a good scrubbing with an old toothbrush. Give it lots of extra degreaser on the brush and the cassette while you’re doing all this. Dry, give it a spray with WD40 or similar. Remount on wheel.
If the chain is that caked in crap it’s worth just binning it.
You’ll have to clean the chainrings and jockey wheels as well, they will also be covered in it and if you put a new chain on it’ll just pick up all the old crap off the jockey wheels and spread it around te place again.
And don’t use wet lube, it’s a nightmare for turning everything into a greasy black gunk.