Following is just a proof, that your code is fine and is totally doing what you expect.
mysql> select version();
+------------------------+
| version() |
+------------------------+
| 5.1.41-3ubuntu12.7-log |
+------------------------+
1 row in set (0.00 sec)
create table highscore(user int, points int, modality int, time int, level int, unique key idx_u_m (use r, modality));
Query OK, 0 rows affected (0.11 sec)
mysql> INSERT INTO highscore(user, points, modality, time, level)
-> VALUES(1, 1, 1, 1, 1)
-> ON DUPLICATE KEY UPDATE
-> points = IF(VALUES(points) > points, VALUES(points), points),
-> time = IF(VALUES(points) > points, VALUES(time), time),
-> level = IF(VALUES(points) > points, VALUES(level), level);
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO highscore(user, points, modality, time, level)
-> VALUES(1, 1, 1, 1, 1)
-> ON DUPLICATE KEY UPDATE
-> points = IF(VALUES(points) > points, VALUES(points), points),
-> time = IF(VALUES(points) > points, VALUES(time), time),
-> level = IF(VALUES(points) > points, VALUES(level), level);
Query OK, 0 rows affected (0.15 sec)
mysql> select * from highscore;
+------+--------+----------+------+-------+
| user | points | modality | time | level |
+------+--------+----------+------+-------+
| 1 | 1 | 1 | 1 | 1 |
+------+--------+----------+------+-------+
1 row in set (0.00 sec)
mysql> INSERT INTO highscore(user, points, modality, time, level)
-> VALUES(1, 2, 1, 1, 1)
-> ON DUPLICATE KEY UPDATE
-> points = IF(VALUES(points) > points, VALUES(points), points),
-> time = IF(VALUES(points) > points, VALUES(time), time),
-> level = IF(VALUES(points) > points, VALUES(level), level);
Query OK, 2 rows affected (0.09 sec)
mysql> select * from highscore; +------+--------+----------+------+-------+
| user | points | modality | time | level |
+------+--------+----------+------+-------+
| 1 | 2 | 1 | 1 | 1 |
+------+--------+----------+------+-------+
1 row in set (0.00 sec)
mysql> INSERT INTO highscore(user, points, modality, time, level)
-> VALUES(2, 2, 1, 1, 1)
-> ON DUPLICATE KEY UPDATE
-> points = IF(VALUES(points) > points, VALUES(points), points),
-> time = IF(VALUES(points) > points, VALUES(time), time),
-> level = IF(VALUES(points) > points, VALUES(level), level);
Query OK, 1 row affected (0.03 sec)
mysql> select * from highscore;
+------+--------+----------+------+-------+
| user | points | modality | time | level |
+------+--------+----------+------+-------+
| 1 | 2 | 1 | 1 | 1 |
| 2 | 2 | 1 | 1 | 1 |
+------+--------+----------+------+-------+
2 rows in set (0.00 sec)
mysql> INSERT INTO highscore(user, points, modality, time, level)
-> VALUES(2, 3, 1, 1, 1)
-> ON DUPLICATE KEY UPDATE
-> points = IF(VALUES(points) > points, VALUES(points), points),
-> time = IF(VALUES(points) > points, VALUES(time), time),
-> level = IF(VALUES(points) > points, VALUES(level), level);
Query OK, 2 rows affected (0.08 sec)
mysql> select * from highscore;
+------+--------+----------+------+-------+
| user | points | modality | time | level |
+------+--------+----------+------+-------+
| 1 | 2 | 1 | 1 | 1 |
| 2 | 3 | 1 | 1 | 1 |
+------+--------+----------+------+-------+
2 rows in set (0.00 sec)
$scorevariable to yourpointsfield.