UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8UQAfCOmliQHM/b7S2yzwN+SDBGFXzJLOXowW0lOx+w='
WHERE
key_id = 'a9b33eea4bf7859636d11b329dc874ac9df167dabda249f18466526f4cbe136e'
AND (
token = '8UQAfCOmliQHM/b7S2yzwN+SDBGFXzJLOXowW0lOx+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)