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