UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'br+1cFCvzq+qNKBoKUXI2ffNSepNAunnPun9NAf5YtA='
WHERE
key_id = 'ac99198e932592a465a104892619cac7c2a20c5c4b230d19e182ac99ea963b0a'
AND (
token = 'br+1cFCvzq+qNKBoKUXI2ffNSepNAunnPun9NAf5YtA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)