UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JZSnmYYHgUeQHzEbS2M+HN+WylkdIlpcPkse8pixWtg='
WHERE
key_id = '9b9d96bb2eb8a8cf3fd5de84460f213e49df6d77e441f48338ec7657d69965ac'
AND (
token = 'JZSnmYYHgUeQHzEbS2M+HN+WylkdIlpcPkse8pixWtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)