Nieprawidłowa składnia, popatrz tutaj:
https://dev.mysql.com/doc/refman/8.0/en/insert.html
https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html
Po zobaczeniu przykładów wszystko powinno stać się jasne.
Ogółem poczytaj trochę:
https://4programmers.net/Forum/Bazy_danych/195871-on_duplicate_key
create table txxx2 ( col1 int auto_increment primary key, col2 date not null, col3 varchar(20) default 0, unique key (col2));
insert into txxx2 (col1, col2) values(null, '2012-03-03') on duplicate key update col3 = col3 + 1;
select * from txxx2;
+------+------------+------+
| col1 | col2 | col3 |
+------+------------+------+
| 1 | 2012-03-03 | 0 |
+------+------------+------+
insert into txxx2 (col1, col2) values(null, '2012-03-03') on duplicate key update col3 = col3 + 1;
select * from txxx2;
+------+------------+------+
| col1 | col2 | col3 |
+------+------------+------+
| 1 | 2012-03-03 | 1 |
+------+------------+------+
insert into txxx2 (col1, col2) values(null, '2012-03-03') on duplicate key update col3 = col3 + 1;
select * from txxx2;
+------+------------+------+
| col1 | col2 | col3 |
+------+------------+------+
| 1 | 2012-03-03 | 2 |
+------+------------+------+
insert into txxx2 (col1, col2) values(null, '2012-03-04') on duplicate key update col3 = col3 + 1;
select * from txxx2;
+------+------------+------+
| col1 | col2 | col3 |
+------+------------+------+
| 1 | 2012-03-03 | 2 |
| 4 | 2012-03-04 | 0 |
+------+------------+------+
Przy pierwszych trzech insert'ach do bazy trafiły tak jakby 3 rekordy mimo iż jest w bazie tylko jeden wiersz, który ma kolumnę col3, która mówi ile poleciało już insertów w trzym przypadku 3 inserty poleciały do bazy z taką samą wartością, którą jest 2012-03-03. Dałem definicję w tworzeniu tabeli default 0, więc domyślnie jest na zero, zatem licząc od zera do dwóch daje nam to 3 (trzy) rekordy w bazie jako jeden wiersz.
Zasada jest taka ... on duplicate key update ... zależnie od warunku wykonuje określoną akcję na zdublowanych wartościach, (ale kolumna, która ma zdublowane wartości musi chyba mieć np. unique utworzony) a w tym przypadku sumuje duplikaty.