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