UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QOuAQYkBX8PVjm23Nvne+M0pBCHcgaIpVNwMsjc6+1k='
WHERE
key_id = '499dc894029236e7882479df48f0e08de72452efbe7cc589ae25fc714ba9e390'
AND (
token = 'QOuAQYkBX8PVjm23Nvne+M0pBCHcgaIpVNwMsjc6+1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)