Does changing the mass of an object undergoing uniform linear motion affect its velocity? I came across the following question:

A trolley of mass 300 kg carrying a sandbag of 25 kg is moving uniformly with a speed of 27 km/h on a friction less track. After a while, sand starts leaking out of a hole on the trolley’s floor at the rate of 0.05 kg s-1. What is the speed of the trolley after the entire sand bag is empty?

The answer that was given was: 

The system of trolley and sandbag is moving with a uniform speed. Clearly, the system is not being acted upon by an external force. If the sand leaks out, even then no external force acts. So there shall be no change in the speed of the trolley.

However, if you note that there is no external force acting on the system in the direction of motion (say, along the x-axis) then the momentum along the same direction must be conserved.
Therefore, using 
$$ m_1v_1 = m_2v_2 $$
where
$$m_1 = 325 \ kg$$
$$v_1 = 27 \ kmh^{-1}$$
$$m_2 = 300 \ kg$$
$$v_2 = ?$$
We obtain
$$v_2 = 29.25 \ kmh^{-1}$$
Where am I going wrong?
 A: You are neglecting the momentum of the sand: if no internal dynamics relative to the sand is given, you have to assume that the sand just leaks with the same speed of the system. In other words if you were riding the trolley+sandbag system you would just see sand coming out like in a hour glass. For that reason the final momentum will be:
$$(m_{trolley}+m_{sand})v_{fin}=m_{tot}v_{in}$$
Which leads to the result since the total mass is the sum of the two masses on the left hand side.
If that is clear let me add something.
Note that you can expect this result to be just an approximation since while the sand leaks (for instance from a hole in the bottom side of the bag) the total amount of sand in the bag will slowly start falling as the level of the sand in the bag diminishes. This means that the system converts its internal (gravitational) energy into kinetic energy.
If the sand bag has a height $h $ and its center of mass is at a height $h/2$ (for symmetry) at the beginning, at the end the level of the center of mass will have dropped of $h/2$ (you really don't care if after leaving the sandbag the sand continues to fall because it cannot anymore influence the speed of the trolley) so that a total amount of kinetic energy $m_{sand } g h/2$ will be produced. If as said the hole is in the bottom SIDE this kinetic energy alters the motion of the trolley (the sand exits with non zero horizontal speed and the trolley gets a recoil ; this would not happen if the hole was on the bottom, i.e. the recoil would be in vertical). Now to find the final speed you need to apply the conservation of momentum as well as he conservation of energy: in the inertial frame which is initially at rest with the trolley and sand bag you will see that both the trolley and the sand start moving horizontally. At the end of the process you will have:
$$\frac {1}{2}m_{trolley}\Delta v_{trolley}^2+\frac {1}{2}m_{sand}\Delta v_{sand}^2=\frac {gh}{2}m_{sand}$$
$$m_{sand}\Delta v_{sand} +  m_{trolley}\Delta v_{trolley}=0$$
In this way you find both the $\Delta v_s$. The speed of the trolley in the frame in which you initially see the trolley+sand bag moving (at speed $v_{in }$) will be therefore $v_{trolley}=v_{in}+\Delta v_{trolley}$.
This of course relies on the fact that the hole is such that the sand exits perfectly horizontally. If the sand exits vertically the result of your book is exact, not just an approximation (of course as long as we neglect all friction).
