UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PtBOa4ve8ruPRWjoX+l3qiSceJ46/loiPwkF7HMv+zc='
WHERE
key_id = 'd2485f22859c429845cca1fd01c27ff88b53928ea6294333e3fbe78d9791d3c6'
AND (
token = 'PtBOa4ve8ruPRWjoX+l3qiSceJ46/loiPwkF7HMv+zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)