Generating string expression from data for filter
Please note that I am not actually reviewing your code, but guiding you towards hopefully better design, so that you can fix the issues yourself
In that same vein, the code snippets I am including do not contain a full solution, but only the hints towards it.




These kinds of transformations are very easy if you start to decompose them.

For example, you have two different rules for dealing with string data type and list data type, so let's create two different entities to deal with them.

(Here I chose functions as top-level entities, you can create classes too)

def convert_string(key, value):
    return f"{key} == '{value}'"   # I am assuming you want value in quotes


Similarly, define one for lists. (Hint: You should define one entity for dict and list function should only call and compose dict function)

How do you choose which entity to call? Simple, call another entity. 

def choose_function(key, value):
    # Your logic here
    # returns func


And finally, a composing function, which is also your main function.

def convert(params):
    str_list = []
    for key, value in params.items():
        str_list.append(choose_func(key, value)(key, value))
    return ' and '.join(str_list)}




Why it would be better than your solution?


It is much easier to test. Your problem statement is pretty much easy, but these kinds of problems could become very big with lots of complex rules in the long run, where unit testability gives you the confidence to make changes
You divide the problem statement into individual sub-pieces and another sub-problem deal with how to merge those solutions. That would eliminate lots of your _first variables. It also makes it easier in the long run.
Code readability