UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4mTtGqRIHrJGDaTRNCmLoW+hvtCqpN0lH6c+T69ghYs='
WHERE
key_id = 'd540eefa1020cd3cdf94db4bf4e215a2ae3f71d33ef3f4610eb5375d10960cb3'
AND (
token = '4mTtGqRIHrJGDaTRNCmLoW+hvtCqpN0lH6c+T69ghYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)