UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '09IMncoNNGOxQYKnzSE7s7/4WIXYwCvO3NDK1kjN4vw='
WHERE
key_id = 'ffc4657df7b098b96f7363f2108ab702ff8fca5063b781fd6114e9f089461282'
AND (
token = '09IMncoNNGOxQYKnzSE7s7/4WIXYwCvO3NDK1kjN4vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)