Here you have, as almost always, different options
make a loop
so you don't spawn directly and run a loop where the loop checks if the new spawn point is greater than 30 (check it against a variable you set when an object gets created)
Or you could make it with an array and spawn points (invisible sprite objects where the new objects get spawned) so instead of pixels you spawn them from the boxes - this is very useful if you want the objects get spawned evenly across the screen.
Also with a loop, but here you can decide very precisely what you want to do.
Or you could make a small random number and multiply it by 30 (still you need a loop to check where the last spawn happened). Th long version would look like this floor(random (0, windowWidth/30))*30