There is no difference. It is equivalent to shape:setY(math.random(0, 400))
.
The second line of code is equivalent to the following:
self:setPosition(540, math.random(1, 160) + 40)
It is most certainly intended to be a clearer and/or simpler way of writing
self:setPosition(540, math.random(41, 200))