UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I2cndLcSDkGERHRpR+kqjrRpUThMv1Kgeyp8x0Miqyc='
WHERE
key_id = '77a730ef6e94005251c242b0a3aabf24c6342ceb3e3c05de94a64beab096ff24'
AND (
token = 'I2cndLcSDkGERHRpR+kqjrRpUThMv1Kgeyp8x0Miqyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)