select * from dim_contracts where valid_from <= '2023-01-01 01:00:00' and (valid_to > '2023-01-01 01:00:00' or valid_to is null)