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