A microscopic mechanism for rejuvenation and memory effects in spin glasses