UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QpWoW4valEWrC0bUitdW7ua8q9prw2JwLTiC5AxHsJk='
WHERE
key_id = 'f677ccf921e5360c251455d43f662647da6d074c2762c927ba2ae6451c2a7768'
AND (
token = 'QpWoW4valEWrC0bUitdW7ua8q9prw2JwLTiC5AxHsJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)