UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YDushUtnoliLhNeE+gXqdqOeg93dpBsBUHfhgwmu8SA='
WHERE
key_id = 'b6f9d8b431e534c9f870c8befaf1858543135e9246e2375e8188f523827c6adc'
AND (
token = 'YDushUtnoliLhNeE+gXqdqOeg93dpBsBUHfhgwmu8SA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)