Automatically delete posts based on query

Here is what I ended up with: Basically, I had the logic of the timing at the bottom wrong. Figuring out times and dates and what note is hard…

add_action('init', 'delete_unclaimed_apps');
function delete_unclaimed_apps() {
    $availapps = get_posts(array(
        'post_type' => 'appointment', 
        'post_status' => 'publish',
        'meta_query' => array (
            array(
                'key' => 'app_status',
                'value' => 'available',
            ),
        ),
    ));
    foreach ($availapps as $post) {
            $timestamp = get_post_meta($post->ID, 'app_timestamp', true);
            $now = time() - (7*60*60);
            $cutoff = (get_field('minimum_reserve_notice', 'options') * 60 * 60);
            if ($now > ($timestamp - $cutoff)) {
                wp_trash_post($post->ID);
            }
    }
}