UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vQjXBpGp4Pb9TwEewLbatvEV9gyEV/9L27WVUSmQrMw='
WHERE
key_id = 'f8407575b090d9b1ae58af7b66668b926db14d3566471111f8e3f7d97c8865bb'
AND (
token = 'vQjXBpGp4Pb9TwEewLbatvEV9gyEV/9L27WVUSmQrMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)