UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Nvh8dtjwrlLn1H5twqavHAfo7a77oKG906z89szQfA='
WHERE
key_id = '339851ad5213c5bb19877053a2cce27d16465b974d89326e806fc1efb06dca1e'
AND (
token = '6Nvh8dtjwrlLn1H5twqavHAfo7a77oKG906z89szQfA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)