INSERT INTO point_history (member_id, amount, reason, created_at) VALUES (#{memberId}, #{amount}, #{reason}, NOW()) UPDATE member SET points = GREATEST(0, points + #{amount}), updated_at = NOW() WHERE id = #{memberId}