UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vHKSy0113n4YwUVYuso2Sn7xEXD+fijv1vvfVgvm8+w='
WHERE
key_id = '1e5212490abc0f5334de50c3ffb3ef7b08928504a4a85c827353569a8b8eccde'
AND (
token = 'vHKSy0113n4YwUVYuso2Sn7xEXD+fijv1vvfVgvm8+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)