select movie_showtimes_refresh_row(w.id)
  from movie_showtimes_with_current_and_sold_out_and_dirty_and_expiry w
where dirty is true
  or not(expiry is null or now() <= expiry));
