DELETE
FROM xf_user_trophy
WHERE user_id = 123;
UPDATE xf_user AS u
SET u.trophy_points = (
SELECT SUM(t.trophy_points)
FROM xf_user_trophy AS ut
LEFT JOIN xf_trophy AS t ON (t.trophy_id = ut.trophy_id)
WHERE ut.user_id = u.user_id
)
WHERE u.user_id = 123;