UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N29cXVXu3vCUoGscmKLUiuoutgChwZqJ2+oSx0jeD/g='
WHERE
key_id = 'f944167b298eec5992611cf3f0168dcd4b5fef654b071c0407caae07ab7fe1d0'
AND (
token = 'N29cXVXu3vCUoGscmKLUiuoutgChwZqJ2+oSx0jeD/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)