SGD with memory: fundamental properties and stochastic acceleration