UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f661cv9BqjvV5IGfA1ojr5qm32PdtbdjVB5vBFqsGS0='
WHERE
key_id = 'ed1035e480de812875d26658c99aeb81a8ab06121df03f3403568f00c30f19a3'
AND (
token = 'f661cv9BqjvV5IGfA1ojr5qm32PdtbdjVB5vBFqsGS0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)