I used to cycle on the sand from Irvine to Troon when the tide was out,and yes,it left a fair old mess of the chain and cassette.
I will tell you what was really dodgy though,the road running alongside the beach towards town

The thin layer of sand on tarmac made even the slightest of bends a bit "drifty".
As for the chain and cassette ?
I would have to find the nearest garage and wash them pretty quick.Who knows why I thought it a good idea to have a beach ride.
Even then,I couldn'tget all of it off,so the ride through Troon,Loans,up Dundonald Hill and back to Irvine was causing unseen damage.
I used to whip it off altogether and thoroughly clean them.