UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cteCL55t7odSAjjrP8k+jq7rEow2Mwp8orSvaG2DqJA='
WHERE
key_id = 'be2969a26e21ee8c504d5609ad852ec87b48c242cf255852e04daa7cfe9d74f0'
AND (
token = 'cteCL55t7odSAjjrP8k+jq7rEow2Mwp8orSvaG2DqJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)