mysql: avoid duplicate updates