Since sand is "gritty", you should spend extra time making sure you have absolutely removed every bit of sand from the chain links so you get better wear from your chain and gears! You can do either a "on the bike cleaning" and lubrication or a complete removal of the chain to clean and lubricate it. If you continually ride in this type of environment, a complete removal/lubrication would be best. Here are the two different methods.
Before each ride, look at the entire chain by standing to the side of your bike and lifting the rear wheel off the ground. Using your free hand, rotate the closest pedal slowly backward, inspecting the individual chain links for dirt buildup, rust and/or tight links (links that do not bend easily as they pass through the rear derailleur). Check for adequate lubrication by listening for squeaks while riding. If you find either condition, your chain needs at least a spot-cleaning.
To spot-clean the chain while it's still installed on your bike, simply brush out the links with a firm brush (toothbrushes work well) and relubricate the links from time to time with a chain lubricant. Remember to wipe off excess lubricant with a clean, dry rag so that it doesn't pick up new dirt. Over-lubricating can cause as many problems as under-lubricating.
Every few months or so (more often for mountain bikes), completely remove your chain (using a chain-removal tool), brush it well and completely immerse it in a chain solvent to get rid of built-up grime that brushing can't remove. Let the chain soak until most of the dirt has been freed from the links and bushings. Dry the entire chain using a clean rag. Make sure that the solvent has completely evaporated, then relubricate the chain and re-install.
Remember to use a recommended lubricant on the chain, and follow the directions for applying and removing excess lubricant. Just remember...WD-40 IS NOT a lubricant!