Save state of MySQL database when updating clean state