UPDATE videos v
JOIN (SELECT video_id, MIN(created_at) AS first_job FROM transcode_jobs GROUP BY video_id) j
  ON j.video_id = v.id
SET v.published_at = NULL
WHERE v.status = 'processing'
  AND v.published_at IS NOT NULL
  AND j.first_job < DATE_ADD(v.created_at, INTERVAL 1 HOUR);
