My shop was working fine until it suddenly started with the invalid token error.
It turned out that my hosting service hit its maximum file limit, this meant the token could not be stored in the backend and I got the invalid token error presumably because an old token was being read.
I deleted some files and the shop started working.