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