adding timeout to cron lock file

fixes https://github.com/owncloud/core/issues/3221

This PR leaves the cron code almost untouched to allow backporting - if required/requested.

Overall the cron code needs refactoring to allow unit testing and proper code structure.

@PVince81 @MorrisJobke @Raydiation please review

@karlitschek @craigpg @MTRichards for your information
After this loop, if I follow the code path I don't see any function that would delete the lock file once it's finished.
Is that intended ?