UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6wHfTeMxUigvLsf/iqB2C62mFiT3k/NOJfOqgN+mYs='
WHERE
key_id = '8347c32ae056319ca7ceeccff3071d6dbde99bd95a9888f1377beef5ae2983cd'
AND (
token = 'S6wHfTeMxUigvLsf/iqB2C62mFiT3k/NOJfOqgN+mYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)