The sandy soil bit might be key. I'd be afraid that anything you were to add, would simply leach out.
Did you find this article?
https://www.growerssecret.com/blog/ferti-facts-magnesium0
"Today, magnesium can be extracted from dolomite (CaCO3·MgCO3), or carnallite (KCl·MgCl2·6H2O), but is most often obtained from seawater."
Have you considered a different approach - biochar, carbon and microbes? Making biochar from whatever woody material you can easily acquire, inoculating it with microbes from decent compost, and mixing it into your soil. Yes, some people make a big deal about temperature and size of "perfect" biochar, but if the issue is sandy soil and you can make the biochar yourself out of local, free material (think heat-treated pallets if that's what's free), perfect isn't necessary.
Here's a link to permies biochar forum if you want to take a look:
https://permies.com/f/190/biochar