PHP is not a multi tasking language, you should not try to use it as such. In other words, long polling is not something you should try to even attempt unless you use a language construct designed to support it.
Specifically to your question, you probably fail because wordpress has the habit of caching in memory as mach info that is retrieved from the DB as it can (this is core feature, no plugins involved). To the best of my memory once post metadata is retrieved it is cached and therefor get_post_meta( $post_id, 'last_modified', true )
always returns the same value. You need to invalidate the cache to be able to do what you are trying to, or send a query to the DB bypassing the WP API.
In addition your code has very bad influence on the performance of the server as you get one apache process busy without doing anything useful, which if you have the apache to run 10 processes means that you can serve 10% less requests at the time your code is working.
Another factor is the php execution time limit which is usually set to 30 seconds, therefor your long polling process will just die after 30 seconds without giving you any notification about it.