Automatically changing a posts status to draft based on magic fields [closed]

For cron jobs, take a look at the Transients API.

The rest could maybe be acchieved with something like the following. I have never ever used the transient API before and code’s not tested.

function set_post_to_draft()
    global $post;

    if ( get_post_meta( $post->ID, 'set_to_draft_key' ) == true );
        return $post->post_status == 'draft';
set_transient( 'post_to_draft_transient', set_post_to_draft(), 60*60*12 ); // 12h interval