Update where clause using date calculation?

I want to disable users who have not logged in for X days. The “X” days is stored in a table and can be changed by the end user. In the sec_user table, I’ve added ‘last_login’ field. I’ve worked through the logic and it works - but I am having trouble with date calculations used in the where clause of the update statement.

This does not work:
sc_exec_sql("UPDATE sec_users SET active = ‘N’ WHERE last_login <= date(“Y-m-d”,strtotime(’+90 Days’)) ") ;

Neither does this:
//2016-0731:bh Disable users who have not been active in X days
//getting the current date from php
$current_date = date(‘Y-m-d’);

//Get the value of sec_rules disable_users
$query = "SELECT
rule_value
FROM sec_rules
WHERE rule_id = ‘DISABLE_USER’ ";

sc_lookup(rs, $query);
$disable_days = {rs[0][0]};

//Difference between the two
$query2 = "SELECT
last_login
FROM sec_users " ;

sc_lookup(rs, $query2) ;
$last_login_date = {rs[0][0]} ;

//getting the current date from php
{amount_days} = sc_date_dif({last_login_date}, ‘aaaa-mm-dd’, $current_date, ‘aaaa-mm-dd’);

if({amount_days} > 0)
{
//if amount is bigger then 0,user is recently active - do not disable

}
elseif({amount_days} <= 0)
{
//if amount is less or equal to 0, user has NOT been active
sc_exec_sql("UPDATE sec_users SET active = ‘N’ WHERE {amount_days} <= 0 " ) ;
}

Try with

WHERE last_login <= date_add(now(), interval -4 day)

Much simpler. This is what I’ve done to it:
//Get the value of sec_rules disable_users
$query = "SELECT
rule_value
FROM sec_rules
WHERE rule_id = ‘DISABLE_USER’ ";

sc_lookup(rs, $query);
$disable_days = {rs[0][0]};

sc_exec_sql("UPDATE sec_users SET active = ‘N’ WHERE last_login <= subdate(now(), $disable_days) ") ;