UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vtF8JDbCHN11h3yPrm1xPki/Ht41hZoybbdoTrl+Wpc='
WHERE
key_id = 'f34331d0ce1cfa0a6a11dde5f868e7edf5cf41ab1f2400f85b678f18bad16705'
AND (
token = 'vtF8JDbCHN11h3yPrm1xPki/Ht41hZoybbdoTrl+Wpc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)