UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e75QpWWccQ0hPzAmRlziBYKTl1BnvwrFHUoWotvt4vw='
WHERE
key_id = '397b0f258cdcb804020c4dc3b0732dd05b7aa0432af64c0a83510074f1798783'
AND (
token = 'e75QpWWccQ0hPzAmRlziBYKTl1BnvwrFHUoWotvt4vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)