UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MIteNbW5nxhm7qIqM4Gws6r5wuFD+sG10JW0CcIsdgw='
WHERE
key_id = '52eb23858ac478111058ae96cf160d67aa33391b09fa95d560fdaf7cb5c75889'
AND (
token = 'MIteNbW5nxhm7qIqM4Gws6r5wuFD+sG10JW0CcIsdgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)