INSERT INTO bets (uid, bet, created_at)
VALUES (1, 5000, CURRENT_TIMESTAMP())
ON DUPLICATE KEY UPDATE
    bet = GREATEST(bet, VALUES(bet)),
    created_at = CURRENT_TIMESTAMP();

# log biggest bets

INSERT INTO wins (uid, win, created_at)
VALUES (1, 5000, CURRENT_TIMESTAMP())
ON DUPLICATE KEY UPDATE
    win = GREATEST(bet, VALUES(win)),
    created_at = CURRENT_TIMESTAMP();

# log biggest bets