UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b8lO6SclcEtQ4hwEk6eggrIyl2ZqLMARW9wVk3DwZC4='
WHERE
key_id = '4e08dea5124a35aea0a9977fb969aba63a6a670d1de47781d4a347a12c3788bb'
AND (
token = 'b8lO6SclcEtQ4hwEk6eggrIyl2ZqLMARW9wVk3DwZC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)