UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fXFpVOZ0k+yiNFiC04EWvjKOnjCm2SqBN07RVbh9D40='
WHERE
key_id = '018401b9387bc3e381b21f56b9851e125446fbf1dc7a401d9fd67bb1b50e9a67'
AND (
token = 'fXFpVOZ0k+yiNFiC04EWvjKOnjCm2SqBN07RVbh9D40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)