UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2UjanO9C4H0LNppwEPeS06803ffe1ebO+dX4yITD2eI='
WHERE
key_id = '32e76e91d32ccddd7b29733424b802105ab2a964f747d14d9f2c87ab900d3484'
AND (
token = '2UjanO9C4H0LNppwEPeS06803ffe1ebO+dX4yITD2eI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)