UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0ezqOhXxZVkR4babzy6QqSBVdD+XAH3reUuEvPPkiU='
WHERE
key_id = '9fd549d66088b64316974f7a032dfe37b75603f033f5d90cb04b055fa74137c3'
AND (
token = 'i0ezqOhXxZVkR4babzy6QqSBVdD+XAH3reUuEvPPkiU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)