Nejsem si jistý, zda je to velmi efektivní, ale funguje pouze v jednom dotazu :
UPDATE t
JOIN (
SELECT MAX(t.id) AS maxid, lat, lon
FROM t
JOIN t AS duplicates
USING (lat, lon)
GROUP BY lat, lon
HAVING COUNT(*) > 1
) AS maxima USING (lat, lon)
SET flag = IF(id = maxid, 1, 2);