UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DxUYvydYeV83FVn2neD7MT18Y2+lOvHcWKsEqdNn2Qo='
WHERE
key_id = '364572d645bd3bf3c506336c431f888e90f0a40736953170647cbc7a4e0a9cab'
AND (
token = 'DxUYvydYeV83FVn2neD7MT18Y2+lOvHcWKsEqdNn2Qo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)