prepare(" UPDATE survey_urls SET status = 'timeout', actual_loi_seconds = TIMESTAMPDIFF(SECOND, clicked_at, NOW()) WHERE status = 'clicked' AND clicked_at < DATE_SUB(NOW(), INTERVAL 2 HOUR) "); $stmt->execute(); $count = $stmt->rowCount(); if ($count > 0) { echo "[$timestamp] Timed out $count URL(s)\n"; } else { echo "[$timestamp] No URLs to timeout\n"; } } catch (Exception $e) { echo "[$timestamp] ERROR: " . $e->getMessage() . "\n"; error_log("Timeout cron error: " . $e->getMessage()); exit(1); } ?>