Update to where clause

Replaced deprecated $wpdb->escape with WordPress esc_sql() function.