UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1fGXPxA/7cIhQuDiU78m32Q2s6kScyxiN92jxzQ/0PM='
WHERE
key_id = '5619eda877d456c0f1ee54ba07747ee0736a425a0a0dfd8a9d3022992327641d'
AND (
token = '1fGXPxA/7cIhQuDiU78m32Q2s6kScyxiN92jxzQ/0PM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)