SELECT CASE WHEN COUNT(*) = 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_s1_dashboard_rebuild_job';

SELECT CASE WHEN COUNT(*) = 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_s1_mdp_run_lock';

SELECT CASE WHEN COUNT(*) = 0 THEN 1 ELSE 0 END AS ok
FROM mdp_transform_run_log
WHERE job_code = 'S1_MDP_SYNC_TRANSFORM'
  AND status = 'RUNNING'
  AND start_time < DATE_SUB(NOW(), INTERVAL 30 MINUTE);
