I am sure magnesium is in no way universal cure. But interestingly cysteine is used to reduce ATP so you might have the same condition I have, which is instead of low ATP, high ATP.
High ATP could end up, creating a lot of oxidative stress in the mitochondria and end up inhibiting ATP as well. And the cystine can reduce oxidative stress inside the mitochondria to repair it.
In my own first-person experience, magnesium supplementation has had no discernable effect on Cocaine Use Disorder.
N-acetylcysteine (NAC), on the other hand, has had a minor but noticeable ability to mitigate cravings.[1]
[1] https://pubmed.ncbi.nlm.nih.gov/28213190/