I have a SQL expression that I use in Make Feature Layer in Model Builder ("HOSPITAL" = '% HOSPITALNAME%'). The expression makes a selection in a OD Cost Matrix that a patient is patient only at one hospital and not all hospitals as an OD Cost Matrix would normally do. HOSPITAL is a column in orgins in add location and HOSPITALNAME is a column in the DESTINATION to add location. What I wonder is how this expression will be in a python script? I've tried something like this in python in the expression field in arcpy.MakeFeatureLayer "'HOSPITAL' = '" + HOSPITAL NAME + "'". But it does not works. I don't get any error message but it only runs OD Cost Matrix normally.
You can always play with "" and '' to open and close string parts, or put special characters after \, but it quickly get complicated with multiple symbols. You need to make sure that the string that will be read in Python will be the string that you type as a query. In your case, this would be :
'"fieldName" = " ' + variable_with_the_fieldname + '"'
"fieldname" = "otherfieldname"
'"fieldName" = ' + "'" + variable_with_string_value + "'"
"fieldname" = 'stringvalue'
The more easy way is to use the triple """ so that you don't have to worry about 's and "s anymore inside your string.
Remark, with some database (e.g. personnal geodatabase), the name of the field must be in  instead of "".