Quantum work of an optical lattice