UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ome6BLaVwpS64mvWhEKQvXRz7c1FOjfl41FqpvqkJE4='
WHERE
key_id = 'e738d354ff31f35aec6e01a75c0818519382f20ea12bdbd5e528bbec98d699ce'
AND (
token = 'Ome6BLaVwpS64mvWhEKQvXRz7c1FOjfl41FqpvqkJE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)