I would replace
DATEDIFF(MINUTE, @ScannedTime, updates.ScannedTime) < 2
Cause if the second argument is bigger than the third argument (the dates), you will have a negative result. And... a negative result is smaller than 2.
by
updates.ScannedTime > DATEADD(MINUTE, -2, @ScannedTime)
or invert parameters
DATEDIFF(MINUTE, updates.ScannedTime, @ScannedTime) < 2